import { FormSchema } from '@/components/Form';
import { useI18n } from '@/hooks/web/useI18n';
import { h } from 'vue';
import { BasicColumn } from '/@/components/Table/src/types/table';
import { currentyOptions } from '/@/settings/commonSetting'
const { t } = useI18n();
export const editData: FormSchema[] = [
  // {
  //   field: 'maintain',
  //   component: 'RadioGroup',
  //   label: '维护操作',
  //   required: true,
  //   defaultValue: 1,
  //   colProps: {
  //     span: 20,
  //   },
  //   componentProps: {
  //     options: [
  //       { label: '开放', value: 1 },
  //       { label: '维护', value: 2 },
  //     ],
  //   },
  // },
  {
    field: 'maintain_start_time',
    component: 'DatePicker',
    required: true,
    label: '开始时间',
    slot: 'startTime',
    //labelWidth: '150px',
    colProps: {
      span: 20,
    },
  },
  {
    field: 'maintain_end_time',
    component: 'DatePicker',
    required: true,
    label: '结束时间',
    slot: 'endTime',
    //labelWidth: '150px',
    colProps: {
      span: 20,
    },
  },
  {
    field: 'notice',
    component: 'Input',
    label: '维护说明',
    required: true,
    // defaultValue: false,
    colProps: {
      span: 20,
    },
    slot: 'notice',
    ifShow: (record) => (String(record.values.maintain) === '2' ? true : false),
  },
];

export const columns: BasicColumn[] = [
  {
    title: '游戏类型', //游戏类型
    dataIndex: 'game_class_name',
    width: 80,
    customRender: ({ record }) => {
      return record.game_class_name;
    },
  },
  {
    title: '游戏平台', //游戏平台
    dataIndex: 'platform_name',
    width: 80,
    customRender: ({ record }) => {
      return record.platform_name;
    },
  },
  {
    title: '投注币种', //投注币种
    dataIndex: 'name',
    width: 100,
    customRender: ({ record }) => {
      return currentyOptions[record.currency_id];
    },
  },
  {
    title: '有效投注', //有效投注
    dataIndex: 'valid_bet_amount',
    width: 100,
    customRender: ({ record }) => {
      return record.valid_bet_amount;
    },
  },
  {
    title: '游戏输赢', //游戏输赢
    dataIndex: 'net_amount',
    width: 100,
    customRender: ({ record }) => {
      let styleColor = '#333333';
      if (record.net_amount > 0) {
        styleColor = '#D9001B';
      }
      if (record.net_amount < 0) {
        styleColor = '#63A103';
      }
      return h('span', { style: { color: styleColor } }, record.net_amount);
    },
  },
  {
    title: '收取费率', //收取费率
    dataIndex: 'fee_rate',
    width: 100,
    customRender: ({ record }) => {
      return h('span', { style: {} }, record.fee_rate + '%');
    },
  },
  {
    title: '费用(本币)', //盈率
    dataIndex: 'games_fee',
    width: 100,
    customRender: ({ record }) => {
      return h('span', { style: {} }, record.games_fee);
    },
  },
  {
    title: '换算汇率(U)', //平台费用(U)
    dataIndex: 'exchange_rate',
    width: 100,
    customRender: ({ record }) => {
      return record.exchange_rate;
    },
  },
  {
    title: '交收费用(U)', //交收费用(U)
    dataIndex: 'settlement_fee',
    width: 140,
    customRender: ({ record }) => {
      const styleColor = '#D9001B';
      return h('span', { style: { color: styleColor } }, record.settlement_fee);
    },
  },
  {
    title: '备注', //折扣费用(U)
    dataIndex: 'remark',
    slots: { customRender: 'remarkDiv', style: { textAlign: 'center' } },
    customRender: ({ record }) => {
      return record.remark;
    },
  },
];
